package com.shop.zkmall.app.controller.a;

import com.shop.zkmall.app.domain.req.AddCoupon;
import com.shop.zkmall.app.domain.req.AddMch;
import com.shop.zkmall.app.domain.req.EditCereBuyerMerchant;
import com.shop.zkmall.app.domain.res.AddMachRecord;
import com.shop.zkmall.app.service.a.ICereBuyerMerchantService;
import com.shop.zkmall.app.utils.R;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("merchant")
@RequiredArgsConstructor
@Tag(name = "商家模块", description = "商家模块")
public class BuyerMerchantController {

    private final ICereBuyerMerchantService iCereBuyerMerchantService;

    @RequestMapping(value = "addMerchant", method = RequestMethod.POST)
    @Operation(summary = "商家申请")
    public R<String> addMerchant(@Validated @RequestBody AddMch addMch) {
        return iCereBuyerMerchantService.addMerchant(addMch);
    }


    @RequestMapping(value = "addMerchantRecord", method = RequestMethod.GET)
    @Operation(summary = "申请记录")
    public R<List<AddMachRecord>> addMerchantRecord() {
        return iCereBuyerMerchantService.addMerchantRecord();
    }


    @RequestMapping(value = "editMerchant", method = RequestMethod.POST)
    @Operation(summary = "修改商家信息")
    public R<?> editMerchant(@RequestBody EditCereBuyerMerchant editCereBuyerMerchant) {
        return iCereBuyerMerchantService.editMerchant(editCereBuyerMerchant);
    }
}
